package com.ctshk.common.enums.appUser;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 *  证件类型数据
 * </p>
 *
 * @author 李新科
 * @date 2021/6/7 14:50
 */
@AllArgsConstructor
public enum CertificateTypeEnum {

    /**
     * 证件类型枚举
     */
    CERTIFICATE_TYPE_1(1384777811377651713L,"ZJ_1","香港身份证"),
    CERTIFICATE_TYPE_2(1352196993725890562L,"ZJ_2","回乡证"),
    CERTIFICATE_TYPE_3(1352197034544857089L,"ZJ_3","港澳通行证"),
    CERTIFICATE_TYPE_4(1369475300672593922L,"ZJ_4","护照"),
    CERTIFICATE_TYPE_5(1384779025322475521L,"ZJ_5","身份证"),
    CERTIFICATE_TYPE_6(1400398978698350593L,"ZJ_6","台胞证"),
    CERTIFICATE_TYPE_7(1400400777341734914L,"ZJ_7","外国人永久居留身份证"),
    ;

    private static List<CertificateTypeEnum> list = Arrays.stream(CertificateTypeEnum.values()).collect(Collectors.toList());

    @Getter
    @Setter
    private Long id;

    @Getter
    @Setter
    private String code;

    @Getter
    @Setter
    private String value;

    public static String parseValue(String code){
        for (CertificateTypeEnum type : CertificateTypeEnum.values()) {
            if (type.code == code) {
                return type.getValue();
            }
        }
        return null;
    }

    public static List<CertificateTypeEnum> getList() {
        return list;
    }
}
